package x.y.z;

import java.util.ArrayList;
import java.util.List;

public class LeetCode_0589 {
    private List<Integer> result = new ArrayList<>();

    public List<Integer> preorder(Node root) {
        if (root != null) {
            result.add(root.val);
            for (Node node : root.children) {
                preorder(node);
            }
        }
        return result;
    }
}
